import request from '@/utils/http'
import { BaseResult } from '@/types/axios'

interface LoginParams {
  userName: string
  password: string
}

interface UserListParams {
  page?: number
  limit?: number
}
interface UserStaParams {
  status?:number
}

export class UserService {
  // 登录
  static login(params: any) {
    return request.post<BaseResult>({
      url: '/admin/common/login',
      data: params
    })
  }
  
  // 验证码
  static captcha() {
    return request.get<BaseResult>({
      url: '/admin/common/captcha?rand=' + new Date().getTime() ,
    })  
  }

  // 获取用户信息
  static getUserLevel() {
    return request.get<BaseResult>({
      url: 'admin/common/getUserLevel'
    })
  }

  // 获取用户列表
  static getUserList(params?: UserListParams) {
    return request.get<BaseResult>({
      url: '/admin/users',
      params
    })
  }

  // 用户列表--是否新用户
  static getUserupdateUsersStatus(id?:number,params?: UserStaParams) {
    return request.put<BaseResult>({
      url: `/admin/users/updateUsersStatus/${id}`,
      params
    })
  }
  // 用户列表--是否禁玩
  static getUserupdateUserStatus(id?:number,params?: UserStaParams) {
    return request.put<BaseResult>({
      url: `/admin/users/updateUserStatus/${id}`,
      params
    })
  }
  // 用户列表--是否注销
  static getUserStatus(id?:number,params?: UserStaParams) {
    return request.put<BaseResult>({
      url: `/admin/users/status/${id}`,
      params
    })
  }

  
}
